package com.gaogzhen.security.lock.reentrant;

import lombok.extern.slf4j.Slf4j;

/**
 * 测试类
 */
@Slf4j(topic = "c.TestPhilosopherDinner")
public class TestPhilosopherDinner {
    public static void main(String[] args) {
        // 创建5根筷子
        Chopstick c1 = new Chopstick("筷子1");
        Chopstick c2 = new Chopstick("筷子2");
        Chopstick c3 = new Chopstick("筷子3");
        Chopstick c4 = new Chopstick("筷子4");
        Chopstick c5 = new Chopstick("筷子5");
        // 创建5个哲学家线程
        new Philosopher("苏格拉底", c1, c2).start();
        new Philosopher("柏拉图", c2, c3).start();
        new Philosopher("亚里士多德", c3, c4).start();
        new Philosopher("赫拉克利特", c4, c5).start();
        new Philosopher("阿基米德", c5, c1).start();
    }
}
